

<template>
    <van-nav-bar
        :title="route.name"
        right-text="按钮"
        :left-arrow="leftArrow"
        @click-left="onClickLeft"
        @click-right="onClickRight"
    >
      <template #right>
        <van-icon name="search" size="18" />
      </template>
    </van-nav-bar>


    <div id = "content">
      <router-view />
    </div>

    <van-tabbar route>
      <van-tabbar-item replace to="/" icon="home-o">主页</van-tabbar-item>
      <van-tabbar-item replace to="/team" icon="search">队伍</van-tabbar-item>
      <van-tabbar-item replace to="/user" icon="friends-o">个人</van-tabbar-item>
    </van-tabbar>
</template>

<script setup lang="ts">
import {useRoute, useRouter} from "vue-router";
import {ref, watch} from "vue";
// import {ref} from 'vue';
// import Index from "../pages/Index.vue";
// import Team from "../pages/Team.vue";
// import User from "../pages/User.vue";

const router = useRouter();
const route = useRoute();

const leftArrow = ref(false)
const onClickLeft = () => {
    history.back();
}
const onClickRight = () =>{
  router.push('/search')
}
// const onChange = (index:string) => showToast(`标签 ${index}`);

watch((route), value => {
    console.log(value.name)
    if (value.name === "主页" || value.name === "队伍" || value.name === "个人信息") {
        leftArrow.value = false;
    } else {
        leftArrow.value = true;
    }
})




</script>

<style scoped>

</style>